var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("body"),
    i = t("buff"),
    s = cc._decorator,
    c = s.ccclass,
    l =
        (s.property,
        (function (t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (e.buffs = []), e;
            }
            return (
                n(e, t),
                (e.prototype.get反射伤害百分比 = function () {
                    for (var t = this.buffs, e = 0; e < t.length; e++) {
                        var o = t[e];
                        if (o.state.is反射伤害()) return o.data.value;
                    }
                }),
                (e.prototype.onEnable = function () {
                    this.body = this.getComponent(a.default);
                }),
                (e.prototype.add = function (t) {
                    if (!(t.skill.buff.leixing <= -1)) {
                        var e = this.get(t.skill.buff.leixing);
                        e && e.data.level <= t.skill.buff.level && this.remove(e),
                            this.buffs.push(new i.default(t, this));
                    }
                }),
                (e.prototype.get = function (t) {
                    for (var e = 0; e < this.buffs.length; e++) {
                        var o = this.buffs[e];
                        if (o.buffType == t) return o;
                    }
                    return null;
                }),
                (e.prototype.remove = function (t) {
                    var e = this.buffs.indexOf(t);
                    e > -1 && (this.buffs.splice(e, 1), t.destory());
                }),
                (e.prototype.update = function (t) {
                    this.buffs.slice().forEach(function (e) {
                        return e.update(t);
                    });
                }),
                (e.prototype.get_move_speed_percentage = function () {
                    for (var t = 1, e = 0; e < this.buffs.length; e++) {
                        t *= this.buffs[e].state.get_move_speed_percentage();
                    }
                    return t;
                }),
                (e = r([c], e))
            );
        })(cc.Component));
o.default = l;
